#!/usr/bin/env pythonBasics
# -*-coding:utf-8-*-

#Author:super
import requests

class ApiRequests():
	def request(self,url,method,**kwargs):
		'''
		封装请求方法
		:param url: 请求地址
		:param method: 方法名称
		:param kwargs: 方法参数
		:return:
		'''
		if method == 'get':
			return requests.request(url=url,method='get',**kwargs)
		elif method == 'post':
			return requests.request(url=url,method='post',**kwargs)
		elif method == 'delete':
			return requests.request(url=url,method='delete',**kwargs)
		elif method == 'put':
			return requests.request(url=url,method='put',**kwargs)

	def get(self,url,**kwargs):
		'''返回get请求'''
		return self.request(url=url,method='get',**kwargs)

	def post(self,url,**kwargs):
		'''返回post请求'''
		return self.request(url=url,method='post',**kwargs)

	def delete(self,url,**kwargs):
		'''返回delete请求'''
		return self.request(url=url,method='delete',**kwargs)

	def put(self,url,**kwargs):
		'''返回put请求'''
		return self.request(url=url,method='put',**kwargs)